<template>
  <div>
    <a-radio-group v-model="data" @change="onChange">
      <a-radio
        :style="record.options.display == 1 ? '' : style"
        :value="item.value"
        :key="index"
        v-for="(item, index) in record.options.options"
      >
        <span
          v-if="record.options.optionsColor"
          class="eip-color-btn"
          :style="{ 'background-color': item.color }"
        >
          {{ item.label }}
        </span>

        <span v-else>
          {{ item.label }}
        </span>
      </a-radio>
    </a-radio-group>
  </div>
</template>

<script>
export default {
  name: "eradio",
  data() {
    return {
      style: {
        display: "block",
        height: "30px",
        lineHeight: "30px",
      },
      data: undefined,
    };
  },
  props: ["value", "record", "disabled"],
  watch: {
    value(value) {
      if (value) {
        this.data = value;
      }
    },
  },
  methods: {
    onChange(value) {
      this.$emit("change", value);
    },
  },
};
</script>
<style lang="less" scoped></style>
